package cn.aaalei.service.impl;

import cn.aaalei.mapper.ActionInfoMapper;
import cn.aaalei.mapper.MainMapper;
import cn.aaalei.pojo.*;
import cn.aaalei.service.DataSaveService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
public class DataSaveServiceImpl implements DataSaveService{

    @Resource
    private MainMapper mainMapper;

    @Resource
    private ActionInfoMapper actionInfoMapper;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int addBindInfo(BindDeviceInfo bindDeviceInfo) {
        return actionInfoMapper.addBindInfo(bindDeviceInfo);
    }

    @Override
    public int updateBindInfo(BindDeviceInfo bindDeviceInfo) {
        return actionInfoMapper.updateBindInfo(bindDeviceInfo);
    }

    @Override
    public BindDeviceInfo findBindInfoByStudentNo(String studentNo) {
        return actionInfoMapper.findBindInfoByStudentNo(studentNo);
    }

    @Override
    public BindDeviceInfo findBindInfoByUserId(String userId) {
        return actionInfoMapper.findBindInfoByUserId(userId);
    }

    @Override
    public int addProfileInfo(LoginProfileInfo loginProfileInfo) {
        return actionInfoMapper.addProfileInfo(loginProfileInfo);
    }

    @Override
    public int updateProfileInfo(LoginProfileInfo loginProfileInfo) {
        return actionInfoMapper.updateProfileInfo(loginProfileInfo);
    }

    @Override
    public LoginProfileInfo findProfileInfoByStudentNo(String studentNo) {
        return actionInfoMapper.findProfileInfoByStudentNo(studentNo);
    }

    @Override
    public LoginProfileInfo findProfileInfoByUserId(String userId) {
        return actionInfoMapper.findProfileInfoByUserId(userId);
    }

    @Override
    public int addModifySignInfo(SignLogInfo signLogInfo) {
        return actionInfoMapper.addModifySignInfo(signLogInfo);
    }

    @Override
    public int addUnbindSignInfo(SignLogInfo signLogInfo) {
        return actionInfoMapper.addUnbindSignInfo(signLogInfo);
    }

    @Override
    public int addEvaluateSignInfo(SignLogInfo signLogInfo) {
        return actionInfoMapper.addEvaluateSignInfo(signLogInfo);
    }

    @Override
    public int addAutoSignInfo(SignLogInfo signLogInfo) {
        return actionInfoMapper.addAutoSignInfo(signLogInfo);
    }

    @Override
    public List<SignLogInfo> findSignLogInfoByStudentNo(String studentNo) {
        return mainMapper.findSignLogInfoByStudentNo(studentNo);
    }

    @Override
    public List<AdminInfo> findList(String username) {
        return mainMapper.findList(username);
    }

    @Override
    public Integer findUserExist(String username) {
        return actionInfoMapper.findUserExist(username);
    }

    @Override
    public Integer findWisdomExist(String username) {
        return actionInfoMapper.findWisdomExist(username);
    }

    @Override
    public int addUser(AdminInfo adminInfo) {
        return actionInfoMapper.addUser(adminInfo);
    }

    @Override
    public Integer findUserScore(String username) {
        return actionInfoMapper.findUserScore(username);
    }

    @Override
    public int updateUserScore(String username, int score) {
        return actionInfoMapper.updateUserScore(username,score);
    }

    @Override
    public String findUsernameByStudentNo(String studentNo) {
        return actionInfoMapper.findUsernameByStudentNo(studentNo);
    }

    @Override
    public KeyInfo findKey(String key) {
        return actionInfoMapper.findKey(key);
    }

    @Override
    public Integer updateKey(KeyInfo keyInfo) {
        return actionInfoMapper.updateKey(keyInfo);
    }

    @Override
    public AutoSignAccount findAccount(String studentNo) {
        return mainMapper.findAccount(studentNo);
    }

    @Override
    public int insertAccount(AutoSignAccount account) {
        return mainMapper.insertAccount(account);
    }

    @Override
    public int updateAccount(AutoSignAccount account) {
        return mainMapper.updateAccount(account);
    }

    @Override
    public Integer addDailySignLog(DailySignLogInfo dailySignLogInfo) {
        return actionInfoMapper.addDailySignLog(dailySignLogInfo);
    }

    @Override
    public Integer updateDailySign(UserInfo userInfo) {
        return actionInfoMapper.updateDailySignByUsername(userInfo);
    }

    @Override
    public UserInfo checkDailySignExistByUsername(String username) {
        return actionInfoMapper.checkDailySignExistByUsername(username);
    }

    @Override
    public Integer addRecommendLog(RecommendLog recommendLog) {
        return actionInfoMapper.addRecommendLog(recommendLog);
    }


}
